package com.accesshollywood.indexables.items;

import java.util.Iterator;
import java.util.LinkedHashSet;

import com.accesshollywood.SQL.GFXSQL;
import com.accesshollywood.grfxOrdering.core.CoreGrfxItemSet;
import com.accesshollywood.grfxOrdering.core.CoreStillSet;
import com.accesshollywood.indexables.AbstractIndexedSet;
import com.accesshollywood.indexables.Indexed;

public class GrfxItemList extends AbstractIndexedSet<GrfxItem> {
	protected LinkedHashSet<GrfxItem>	set	= new LinkedHashSet<GrfxItem>();

	public GrfxItemList(){
		super();
		this.set = super.set;
	}
	
	@Override
	public void initSQL() {
		setThat(this);
		tableName = "itemList";
		idColumnName = "idItemList";
		elementColumnName.put(getField("set"), "idItem");
	}

	/*
	 * public void setElement(int idItemList, boolean fromSQL) {
	 * if (fromSQL) {
	 * ResultSet rawItemIDs = SQLUtility.getResultSetFromActiveDB("itemList", "idItem", "idItemList = " + idItemList);
	 * try {
	 * while (rawItemIDs.next()) {
	 * int idItem = rawItemIDs.getInt("idItem");
	 * ResultSet rawItem = SQLUtility.getResultSetFromActiveDB("item", "*", "idItem = " + idItem);
	 * while (rawItem.next()) {
	 * GrfxItem newItem = new GrfxItem();
	 * newItem.setIdItem(idItem);
	 * newItem.setFilename(new NamedList());
	 * newItem.getFilename().addStr(rawItem.getString("fileName"));
	 * newItem.setTextList(GFXSQL.getText(rawItem.getInt("idTextList")));
	 * int idStillList = rawItem.getInt("idStillList");
	 * newItem.setStillList(GFXSQL.getStills(idStillList));
	 * if (newItem.getStillList().name != null && !newItem.getStillList().name.equals("")) {
	 * // Trace.info("***************************************************************" + newItem.stillList.name);
	 * newItem.setApprPhotoEdit(true);
	 * }
	 * newItem.setFootageList(GFXSQL.getFootage(rawItem.getInt("idFootageList")));
	 * newItem.setNeedsResearch(rawItem.getBoolean("needsResearch"));
	 * newItem.setNeedsPhotoEdit(rawItem.getBoolean("needsPhotoEdit"));
	 * newItem.setNeedsFootage(rawItem.getBoolean("needsFootage"));
	 * newItem.setNeedsLegal(rawItem.getBoolean("needsLegal"));
	 * newItem.setApprResearch(rawItem.getBoolean("apprResearch"));
	 * newItem.setApprPhotoEdit(rawItem.getBoolean("apprPhotoEdit"));
	 * newItem.setApprFootage(rawItem.getBoolean("apprFootage"));
	 * newItem.setApprLegal(rawItem.getBoolean("apprLegal"));
	 * add(newItem);
	 * }
	 * }
	 * } catch (SQLException e) {
	 * e.printStackTrace();
	 * }
	 * }
	 * }
	 * public ArrayList<Integer> toItemIDarray(){
	 * ArrayList<Integer> itemIDs = new ArrayList<Integer>();
	 * Iterator itr = iterator();
	 * while(itr.hasNext()){
	 * itemIDs.add(((GrfxItem)itr.next()).getIdItem());
	 * }
	 * return itemIDs;
	 * }
	 * public String toString(){
	 * String output = "";
	 * Iterator itr = iterator();
	 * while(itr.hasNext()){
	 * output += itr.next().toString();
	 * }
	 * return output;
	 * }
	 * public boolean isEmpty(){
	 * return (this.size() == 0);
	 * }
	 * public GrfxItem get(int index) {
	 * int i = 0;
	 * Iterator itr = iterator();
	 * while(itr.hasNext()){
	 * GrfxItem currItem = (GrfxItem) itr.next();
	 * if(i++==index){
	 * return currItem;
	 * }
	 * }
	 * return null;
	 * }
	 */
}
